<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">

    /* tooltip */
    #tooltip{
      position:absolute;
      border:1px solid #ccc;
      background:#333;
      padding:2px;
      display:none;
      color:#fff;
    }
</style>
</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
    <form class="layui-form serch" action="{:url('admin/ly/index')}" method="post">
      <div class="layui-form-item" style="float: left;">
        <div class="layui-input-inline">
          <div class="layui-inline">
            <select name="is_look" lay-search="">
              <option value="">状态</option>
              <option value="0">待处理</option>
              <option value="1">已处理</option>
            </select>
          </div>
        </div>
        <div class="layui-input-inline">
          <div class="layui-inline">
            <div class="layui-input-inline">
              <input type="text" class="layui-input" id="create_time" placeholder="留言时间" name="create_time">
            </div>
          </div>
        </div>
        <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
      </div>
    </form>
  <table class="layui-table" lay-size="sm">
    <colgroup>
      <col width="50">
      <col width="130">
      <col width="80">
      <col width="100">
      <col width="100">
      <col width="100">
      <col width="100">
      <col width="100">
      <col width="100">
      <col width="100">
      <col width="200">
    </colgroup>
    <thead>
      <tr>
        <th>排序</th>
        <th>留言时间</th>
        <th>姓名</th>
        <th>手机号</th>
        <th>QQ</th>
        <th>skype</th>
        <th>公司</th>
        <th>邮箱</th>
        <th>留言</th>
        <th>状态</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
        <form class="layui-form" id="admin">
      {volist name="ly" id="vo"}
      <tr>
        <th>{$vo.id}</th>
        <td>{$vo.create_time}</td>
        <th>{$vo.name}</th>
        <td>{$vo.phone}</td>
        <td>{$vo.QQ}</td>
        <td>{$vo.skype}</td>
        <td>{$vo.company}</td>
        <td>{$vo.email}</td>
        <td>{$vo.liuyan}</td>
        <td>{if condition="$vo.is_look eq 1"}<span class="layui-badge">管理员已阅</span>{else /}<span class="layui-badge layui-bg-orange">管理员待阅</span>{/if}</td>
        <td class="operation-menu">
          <div class="layui-btn-group">
            <a href="javascript:;" class="layui-btn layui-btn-xs look layui-btn-primary" data-id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="fa {if condition="$vo.is_look eq 1"}fa-toggle-on{else /}fa-toggle-off{/if}"></i></a>
            <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-primary delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
          </div>
        </td>
      </tr>
      {/volist}
    </tbody>
  </table>
    </form>
          
  {include file="public/foot"}

    <script type="text/javascript">

      $('.delete').click(function(){
        var id = $(this).attr('id');
        layer.confirm('确定要删除?', function(index) {
          $.ajax({
            url:"{:url('admin/ly/delete')}",
            data:{id:id},
            success:function(res) {
              layer.msg(res.msg);
              if(res.code == 1) {
                setTimeout(function(){
                  location.href = res.url;
                },1500)
              }
            }
          })
        })
      })
    </script>
    <script type="text/javascript">
      layui.use('layer', function(){
        var layer = layui.layer;
        $('.look').click(function(){
          var id = $(this).attr('data-id');
          layer.msg('留言标记',{
            time:20000
            ,btn: ['标记已读', '标记未读', '再想想']
            ,yes: function(index, layero){
              $.ajax({
                url:"{:url('admin/ly/mark')}"
                ,type:'post'
                ,data:{id:id,is_look:'1'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
            ,btn2: function(index, layero){
              $.ajax({
                url:"{:url('admin/ly/mark')}"
                ,type:'post'
                ,data:{id:id,is_look:'0'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
          })
        })
      });
    </script>
</div>
</body>
</html>
